<form class="form-horizontal" id="categoryDetailForm">
    <input name="id" type="hidden" th:value="${category.id}">
    <input id="d-pid"  name="pid" type="hidden" th:value="${category.pid}">
    <div class="box-body">
        <div class="form-group">
            <label  class="col-sm-3 control-label">上级分类 <span class="red">*</span>:</label>
            <div class="col-sm-8">
                <input id="d-pname"  th:value="${category.parent==null?'无':category.parent.name}"  class="form-control cursor-pointer" onclick="showCategory(2)" readonly="readonly" require="">
            </div>
        </div>
        <div class="form-group">
            <label  class="col-sm-3 control-label">分类名称 <span class="red">*</span>:</label>
            <div class="col-sm-8">
                <input th:value="${category.name}" name="name" class="form-control" require="">
            </div>
        </div>
        <div class="form-group">
            <label  class="col-sm-3 control-label">分类描述 <span class="red">*</span>:</label>
            <div class="col-sm-8">
                <input th:value="${category.description}" name="description" class="form-control" require="">
            </div>
        </div>
        <div class="form-group">
            <label  class="col-sm-3 control-label">排序 <span class="red">*</span>:</label>
            <div class="col-sm-8">
                <input th:value="${category.sort}" name="sort" class="form-control" require="" plusinteger="">
            </div>
        </div>
    </div>
    <div class="box-footer">
        <div class="pull-right">
            <button type="button" id="saveDetailCategory" class="btn btn-info">确定</button>
            <button type="button" data-dismiss="modal" class="btn btn-default">取消</button>
        </div>
    </div>
</form>
<script>
    $(function () {
        $('input[type="radio"].minimal').iCheck({
            radioClass: 'iradio_minimal-blue'
        });
        $("#saveDetailCategory").on('click', function () {
            if (doValidForm("#categoryDetailForm")) {
                Core.mask("#saveDetailCategory");
                Core.postAjax("/category/edit",$("#categoryDetailForm").serialize(),function (data) {
                    if (data.status == 200) {
                        Core.unmask("#saveDetailCategory");
                        $("#categoryDetailModal").modal("hide");
                        Core.refreshTable("#table",true);
                    }
                    layer.msg(data.msg);
                })
            }
        });
    });
</script>